﻿-- ----------------------------
-- Table structure for sys_company
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_company]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_company]
GO

CREATE TABLE [dbo].[sys_company] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyName] varchar(255) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Contact] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [ContactPhone] varchar(20) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [Address] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsSystem] bit  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_company] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'CompanyName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系人姓名',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'Contact'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系电话',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'ContactPhone'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系地址',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'Address'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是系统公司',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'IsSystem'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_company',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Records of [sys_company]
-- ----------------------------
INSERT INTO [dbo].[sys_company]  VALUES (N'system', N'系统运营公司', N'system', N'13600000000', N'china', N'1', N'system', N'0', N'2019-08-05 21:02:38.0000000', N'system', N'2019-08-05 21:02:38.0000000', N'system')
GO


-- ----------------------------
-- Primary Key structure for table sys_company
-- ----------------------------
ALTER TABLE [dbo].[sys_company] ADD CONSTRAINT [PK__sys_comp__3214EC07F829697A] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_department
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_department]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_department]
GO

CREATE TABLE [dbo].[sys_department] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ParentId] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Name] varchar(255) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Remark] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_department] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'上级部门Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'ParentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'部门名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'Name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'部门备注信息',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_department',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_department
-- ----------------------------
ALTER TABLE [dbo].[sys_department] ADD CONSTRAINT [PK_sys_department] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_menu]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_menu]
GO

CREATE TABLE [dbo].[sys_menu] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ParentId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Name] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Code] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Url] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Icon] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsMenu] bit  NOT NULL,
  [Remark] varchar(500) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Order] int  NOT NULL,
  [IsSystem] bit  NOT NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_menu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'父级Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'ParentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'编码',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Code'
GO

EXEC sp_addextendedproperty
'MS_Description', N'Url地址',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Url'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单图标',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Icon'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是菜单',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'IsMenu'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序序号',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'Order'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是系统菜单',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'IsSystem'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_menu',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Records of [sys_menu]
-- ----------------------------
INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638912', N'', N'系统设置', N'system', N'#', N'setting', N'1', N'系统设置', N'0', N'0', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638911', N'2019040221272914193846649638912', N'部门管理', N'department', N'/department/list', N'right', N'1', N'部门管理', N'2', N'0', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2020-03-31 14:42:47.7115774', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638913', N'2019040221272914193846649638912', N'公司管理', N'company', N'/company/list', N'right', N'1', N'公司管理', N'1', N'0', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638914', N'2019040221272914193846649638912', N'菜单管理', N'menu', N'/menu/list', N'right', N'1', N'菜单管理', N'3', N'1', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2020-03-31 14:42:53.7606659', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638915', N'2019040221272914193846649638912', N'用户管理', N'user', N'/user/list', N'user', N'1', N'用户管理', N'4', N'0', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2020-03-31 14:42:58.1885427', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019040221272914193846649638916', N'2019040221272914193846649638912', N'角色管理', N'role', N'/role/list', N'right', N'1', N'角色管理', N'5', N'0', N'system', N'0', N'2019-11-25 12:51:04.0000000', N'2019040221272914193846649638912', N'2020-03-31 14:43:02.2425729', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910451714534369555746816', N'2019040221272914193846649638913', N'添加', N'company-add', N'/api/company/create', N'plus', N'0', N'添加公司信息', N'0', N'0', N'system', N'0', N'2019-11-29 10:45:17.8510587', N'2019040221272914193846649638912', N'2019-11-29 11:19:42.7910615', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910451714534369555746817', N'2019040221272914193846649638911', N'添加', N'department-add', N'/api/department/create', N'plus', N'0', N'添加部门信息', N'0', N'0', N'system', N'0', N'2019-11-29 10:45:17.8510587', N'2019040221272914193846649638912', N'2019-11-29 11:19:42.7910615', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910474614534371984347136', N'2019040221272914193846649638913', N'编辑', N'company-edit', N'/api/company/edit', N'edit', N'0', N'编辑公司信息', N'1', N'0', N'system', N'0', N'2019-11-29 10:47:46.0808128', N'2019040221272914193846649638912', N'2019-11-29 11:47:27.5295137', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910474614534371984347137', N'2019040221272914193846649638911', N'编辑', N'department-edit', N'/api/department/edit', N'edit', N'0', N'编辑部门信息', N'1', N'0', N'system', N'0', N'2019-11-29 10:47:46.0808128', N'2019040221272914193846649638912', N'2019-11-29 11:47:27.5295137', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910483114534372722003968', N'2019040221272914193846649638913', N'删除', N'company-delete', N'/api/company/delete', N'delete', N'0', N'删除菜单信息', N'2', N'0', N'system', N'0', N'2019-11-29 10:48:31.1032007', N'2019040221272914193846649638912', NULL, NULL)
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112910483114534372722003969', N'2019040221272914193846649638911', N'删除', N'department-delete', N'/api/department/delete', N'delete', N'0', N'删除部门信息', N'2', N'0', N'system', N'0', N'2019-11-29 10:48:31.1032007', N'2019040221272914193846649638912', NULL, NULL)
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911182914534402184417280', N'2019040221272914193846649638914', N'添加', N'menu-add', N'/api/menu/create', N'plus', N'0', N'', N'0', N'0', N'system', N'0', N'2019-11-29 11:18:29.3461817', N'2019040221272914193846649638912', NULL, NULL)
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911185714534402642202624', N'2019040221272914193846649638914', N'编辑', N'menu-edit', N'/api/menu/edit', N'edit', N'0', N'', N'1', N'0', N'system', N'0', N'2019-11-29 11:18:57.2871126', N'2019040221272914193846649638912', N'2019-11-29 11:47:40.3585633', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911192814534403157430272', N'2019040221272914193846649638914', N'删除', N'menu-delete', N'/api/menu/delete', N'delete', N'0', N'', N'2', N'0', N'system', N'0', N'2019-11-29 11:19:28.7343575', N'2019040221272914193846649638912', N'2019-11-29 11:47:46.1609329', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911201414534403902836736', N'2019040221272914193846649638915', N'添加', N'user-add', N'/api/user/create', N'plus', N'0', N'', N'0', N'0', N'system', N'0', N'2019-11-29 11:20:14.2303516', N'2019040221272914193846649638912', N'2019-11-29 11:47:58.5595442', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911203014534404177448960', N'2019040221272914193846649638915', N'编辑', N'user-edit', N'#', N'edit', N'0', N'', N'1', N'0', N'system', N'0', N'2019-11-29 11:20:30.9914221', N'2019040221272914193846649638912', N'2019-11-29 11:48:04.4032050', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911205114534404509929472', N'2019040221272914193846649638915', N'删除', N'user-delete', N'/api/user/delete', N'delete', N'0', N'', N'2', N'0', N'system', N'0', N'2019-11-29 11:20:51.2840918', N'2019040221272914193846649638912', N'2019-11-29 11:48:10.5410147', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911213114534405176283136', N'2019040221272914193846649638915', N'角色授权', N'user-set-role', N'/api/user/set/role', N'setting', N'0', N'', N'3', N'0', N'system', N'0', N'2019-11-29 11:21:31.9555310', N'2019040221272914193846649638912', N'2019-11-29 11:48:23.0719417', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911215314534405532831744', N'2019040221272914193846649638916', N'添加', N'role-add', N'/api/role/add', N'plus', N'0', N'', N'0', N'0', N'system', N'0', N'2019-11-29 11:21:53.7173303', N'2019040221272914193846649638912', N'2019-11-29 11:48:44.1586628', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911221514534405883121664', N'2019040221272914193846649638916', N'编辑', N'role-edit', N'/api/role/edit', N'edit', N'0', N'', N'1', N'0', N'system', N'0', N'2019-11-29 11:22:15.0973160', N'2019040221272914193846649638912', N'2019-11-29 11:48:49.1480126', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911223314534406190157824', N'2019040221272914193846649638916', N'删除', N'role-delete', N'/api/role/delete', N'delete', N'0', N'', N'2', N'0', N'system', N'0', N'2019-11-29 11:22:33.8371577', N'2019040221272914193846649638912', N'2019-11-29 11:48:54.3443142', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112911225914534406617255936', N'2019040221272914193846649638916', N'权限分配', N'role-set-menu', N'/api/role/set/menu', N'setting', N'0', N'', N'3', N'0', N'system', N'0', N'2019-11-29 11:22:59.9057570', N'2019040221272914193846649638912', N'2019-11-29 11:49:02.0144285', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112914013514534562515996673', N'2019040221272914193846649638912', N'大文件上传', N'file-upload', N'/file/upload', N'file', N'1', N'', N'8', N'0', N'system', N'0', N'2019-11-29 14:01:35.2097008', N'2019040221272914193846649638912', N'2020-03-31 15:29:02.8624217', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112914013514534562515996675', N'2019040221272914193846649638912', N'站内信', N'message', N'/message/list', N'right', N'1', N'', N'6', N'0', N'system', N'0', N'2019-11-29 14:01:35.2097008', N'2019040221272914193846649638912', N'2020-03-31 15:29:32.9646845', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112914013514534562515996677', N'2019112914013514534562515996676', N'发送站内信', N'message-send', N'/api/message/create', N'right', N'0', N'', N'0', N'0', N'system', N'0', N'2019-11-29 14:01:35.2097008', N'2019040221272914193846649638912', NULL, NULL)
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112914013514534562515996678', N'2019112914013514534562515996676', N'标记为已读', N'message-read', N'/api/message/read', N'right', N'0', N'', N'0', N'0', N'system', N'0', N'2019-11-29 14:01:35.2097008', N'2019040221272914193846649638912', NULL, NULL)
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2019112914013514534562515996679', N'2019040221272914193846649638912', N'升级日志', N'upgrade', N'/upgrade/list', N'right', N'1', N'', N'7', N'0', N'system', N'0', N'2019-11-29 14:01:35.2097008', N'2019040221272914193846649638912', N'2020-03-31 15:29:18.9344490', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2020040922394414721928119848960', N'', N'商品设置', N'product-setting', N'#', N'shop', N'1', N'', N'2', N'0', N'system', N'0', N'2020-04-09 22:39:44.1160766', N'2019040221272914193846649638912', N'2020-04-09 22:43:23.0933637', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2020040922401114721928561561600', N'2020040922394414721928119848960', N'产品分类', N'product-category', N'/category/list', N'folder', N'1', N'', N'0', N'0', N'system', N'0', N'2020-04-09 22:40:11.0765061', N'2019040221272914193846649638912', N'2020-04-09 22:42:25.4597542', N'2019040221272914193846649638912')
GO

INSERT INTO [dbo].[sys_menu]  VALUES (N'2020040922402714721928830963712', N'2020040922394414721928119848960', N'产品管理', N'product-manage', N'/product/list', N'profile', N'1', N'', N'1', N'0', N'system', N'0', N'2020-04-09 22:40:27.5193759', N'2019040221272914193846649638912', N'2020-04-09 22:41:56.2697110', N'2019040221272914193846649638912')
GO

-- ----------------------------
-- Primary Key structure for table sys_menu
-- ----------------------------
ALTER TABLE [dbo].[sys_menu] ADD CONSTRAINT [PK__sys_menu__3214EC07BB3572E5] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role]
GO

CREATE TABLE [dbo].[sys_role] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Name] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Code] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Remark] varchar(500) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsSystem] bit  NOT NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'Name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色编码',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'Code'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注信息',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是系统角色',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'IsSystem'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_role
-- ----------------------------
ALTER TABLE [dbo].[sys_role] ADD CONSTRAINT [PK__sys_role__3214EC0743CFECD9] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_role_menu
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role_menu]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role_menu]
GO

CREATE TABLE [dbo].[sys_role_menu] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [RoleId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [MenuId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_role_menu] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'RoleId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'菜单Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'MenuId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_role_menu',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_role_menu
-- ----------------------------
ALTER TABLE [dbo].[sys_role_menu] ADD CONSTRAINT [PK__sys_role__3214EC07EBE9F5EC] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user]
GO

CREATE TABLE [dbo].[sys_user] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [LoginName] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Password] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [SecurityKey] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Name] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsAdmin] bit  NOT NULL,
  [DepartmentId] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DepartmentName] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Email] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [Phone] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Motto] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'登陆账号',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'LoginName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'登陆密码',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Password'
GO

EXEC sp_addextendedproperty
'MS_Description', N'安全密钥',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'SecurityKey'
GO

EXEC sp_addextendedproperty
'MS_Description', N'姓名',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是管理员',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'IsAdmin'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属部门',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'DepartmentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'部门名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'DepartmentName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'邮箱',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Email'
GO

EXEC sp_addextendedproperty
'MS_Description', N'联系电话',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Phone'
GO

EXEC sp_addextendedproperty
'MS_Description', N'座右铭',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'Motto'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Records of [sys_user]
-- ----------------------------
INSERT INTO [dbo].[sys_user]  VALUES (N'2019040221272914193846649638912', N'jucheap', N'5af2e5a0f068234f87531ff5df5d7e0d', N'3e0ab888990841dba755dc13f71e531a', N'系统超级管理员', N'1', N'', N'', N'service@jucheap.com', N'13600000000', N'十步杀一人，千里不留行', N'system', N'0', N'2019-08-05 21:02:38.0000000', N'2019040221272914193846649638912', N'2020-04-03 15:37:35.1833526', N'2019040221272914193846649638912')
GO

-- ----------------------------
-- Primary Key structure for table sys_user
-- ----------------------------
ALTER TABLE [dbo].[sys_user] ADD CONSTRAINT [PK__sys_user__3214EC07EBA4ADAF] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user_role]
GO

CREATE TABLE [dbo].[sys_user_role] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [UserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [RoleId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_user_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'用户Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'UserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'RoleId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'所属公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_user_role
-- ----------------------------
ALTER TABLE [dbo].[sys_user_role] ADD CONSTRAINT [PK__sys_user__3214EC0738500541] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_login_log
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_login_log]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_login_log]
GO

CREATE TABLE [dbo].[sys_login_log] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Result] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_login_log] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'登陆结果信息',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'Result'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_login_log',
'COLUMN', N'ModifyUserId'
GO

-- ----------------------------
-- Primary Key structure for table sys_login_log
-- ----------------------------
ALTER TABLE [dbo].[sys_login_log] ADD CONSTRAINT [PK_sys_login_log] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_visit_log
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_visit_log]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_visit_log]
GO

CREATE TABLE [dbo].[sys_visit_log] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Url] text COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IP] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [LoginAccount] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [UserName] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_visit_log] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'登陆结果信息',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'Url'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_visit_log',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_visit_log
-- ----------------------------
ALTER TABLE [dbo].[sys_visit_log] ADD CONSTRAINT [PK_sys_visit_log] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_upgrade_log
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_upgrade_log]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_upgrade_log]
GO

CREATE TABLE [dbo].[sys_upgrade_log] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Title] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [UpgradeDate] datetime DEFAULT NULL NOT NULL,
  [Version] varchar(20) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_upgrade_log] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'升级标题',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'Title'
GO

EXEC sp_addextendedproperty
'MS_Description', N'升级日期',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'UpgradeDate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'升级版本号',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'Version'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_upgrade_log
-- ----------------------------
ALTER TABLE [dbo].[sys_upgrade_log] ADD CONSTRAINT [PK_sys_upgrade_log] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_upgrade_log_detail
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_upgrade_log_detail]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_upgrade_log_detail]
GO

CREATE TABLE [dbo].[sys_upgrade_log_detail] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [LogId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Detail] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_upgrade_log_detail] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'升级Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'LogId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'升级项目描述',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'Detail'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_upgrade_log_detail',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_upgrade_log_detail
-- ----------------------------
ALTER TABLE [dbo].[sys_upgrade_log_detail] ADD CONSTRAINT [PK_sys_upgrade_log_detail] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_message
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_message]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_message]
GO

CREATE TABLE [dbo].[sys_message] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Title] varchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Contents] nvarchar(2000) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [SendType] tinyint DEFAULT NULL NOT NULL,
  [Sender] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_message] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'站内信标题',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'Title'
GO

EXEC sp_addextendedproperty
'MS_Description', N'站内行内容',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'Contents'
GO

EXEC sp_addextendedproperty
'MS_Description', N'发送方式(0=所有人;1=指定用户)',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'SendType'
GO

EXEC sp_addextendedproperty
'MS_Description', N'发送人姓名',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'Sender'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_message
-- ----------------------------
ALTER TABLE [dbo].[sys_message] ADD CONSTRAINT [PK_sys_message] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for sys_message_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_message_user]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_message_user]
GO

CREATE TABLE [dbo].[sys_message_user] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [MessageId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ReceiverId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [Status] tinyint DEFAULT NULL NOT NULL,
  [ReadTime] datetime  NULL,
  [CompanyId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[sys_message_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'消息Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'MessageId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'接收人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'ReceiverId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态(0=未读;1=已读;2=删除)',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'Status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'sys_message_user',
'COLUMN', N'ModifyUserId'
GO


-- ----------------------------
-- Primary Key structure for table sys_message_user
-- ----------------------------
ALTER TABLE [dbo].[sys_message_user] ADD CONSTRAINT [PK_sys_message_user] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for product
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[product]') AND type IN ('U'))
	DROP TABLE [dbo].[product]
GO

CREATE TABLE [dbo].[product] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [CategoryId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ProductCode] varchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [ProductName] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ProductDescription] nvarchar(300) COLLATE Chinese_PRC_CI_AS  NULL,
  [Contents] text COLLATE Chinese_PRC_CI_AS  NULL,
  [RetailPrice] decimal(18,2)  NOT NULL,
  [SalePrice] decimal(18,2)  NOT NULL,
  [UnitName] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Quantity] int  NOT NULL,
  [IsShowInHome] bit  NOT NULL,
  [IsPublish] bit DEFAULT NULL NOT NULL,
  [Sort] int  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[product] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品分类Id',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'CategoryId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品编码',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'ProductCode'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品名称',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'ProductName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品描述',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'ProductDescription'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品详细内容',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'Contents'
GO

EXEC sp_addextendedproperty
'MS_Description', N'零售价',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'RetailPrice'
GO

EXEC sp_addextendedproperty
'MS_Description', N'销售价',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'SalePrice'
GO

EXEC sp_addextendedproperty
'MS_Description', N'单位',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'UnitName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'数量',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'Quantity'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否首页显示',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'IsShowInHome'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否发布产品',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'IsPublish'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序(越大越靠前)',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'Sort'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'product',
'COLUMN', N'ModifyUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品',
'SCHEMA', N'dbo',
'TABLE', N'product'
GO


-- ----------------------------
-- Primary Key structure for table product
-- ----------------------------
ALTER TABLE [dbo].[product] ADD CONSTRAINT [PK_product] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for product_category
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[product_category]') AND type IN ('U'))
	DROP TABLE [dbo].[product_category]
GO

CREATE TABLE [dbo].[product_category] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ParentId] varchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [CategoryName] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [IsShowInHome] bit  NOT NULL,
  [IsPublish] bit DEFAULT NULL NOT NULL,
  [ImageUrlBig] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [ImageUrlSmall] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [Sort] int  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[product_category] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品分类父级Id',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'ParentId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'分类名称',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'CategoryName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'首页显示',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'IsShowInHome'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否发布',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'IsPublish'
GO

EXEC sp_addextendedproperty
'MS_Description', N'大图Url',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'ImageUrlBig'
GO

EXEC sp_addextendedproperty
'MS_Description', N'小图Url',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'ImageUrlSmall'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序(越大越靠前)',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'Sort'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_category',
'COLUMN', N'ModifyUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品分类',
'SCHEMA', N'dbo',
'TABLE', N'product_category'
GO


-- ----------------------------
-- Primary Key structure for table product_category
-- ----------------------------
ALTER TABLE [dbo].[product_category] ADD CONSTRAINT [PK_product_category] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for product_image
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[product_image]') AND type IN ('U'))
	DROP TABLE [dbo].[product_image]
GO

CREATE TABLE [dbo].[product_image] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ProductId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ImageUrl] varchar(255) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ImageName] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [IsDefault] bit  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[product_image] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品Id',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'ProductId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品编码',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'ImageUrl'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品名称',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'IsDefault'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_image',
'COLUMN', N'ModifyUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品图片',
'SCHEMA', N'dbo',
'TABLE', N'product_image'
GO


-- ----------------------------
-- Primary Key structure for table product_image
-- ----------------------------
ALTER TABLE [dbo].[product_image] ADD CONSTRAINT [PK_product_image] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

-- ----------------------------
-- Table structure for product_spec
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[product_spec]') AND type IN ('U'))
	DROP TABLE [dbo].[product_spec]
GO

CREATE TABLE [dbo].[product_spec] (
  [Id] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ProductId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [SpecName] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [SpecValue] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Sort] int  NOT NULL,
  [CompanyId] varchar(500) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NOT NULL,
  [IsDeleted] bit  NOT NULL,
  [CreateTime] datetime2(7)  NOT NULL,
  [CreateUserId] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ModifyTime] datetime2(7) DEFAULT NULL NULL,
  [ModifyUserId] varchar(50) COLLATE Chinese_PRC_CI_AS DEFAULT NULL NULL
)
GO

ALTER TABLE [dbo].[product_spec] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'Id',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品销售属性类型Id',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'ProductId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品规格名称',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'SpecName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品规则值',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'SpecValue'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序(越大越靠前)',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'Sort'
GO

EXEC sp_addextendedproperty
'MS_Description', N'公司Id',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'CompanyId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否是逻辑删除',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'IsDeleted'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'CreateUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改时间',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'ModifyTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'修改人Id',
'SCHEMA', N'dbo',
'TABLE', N'product_spec',
'COLUMN', N'ModifyUserId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'产品规则',
'SCHEMA', N'dbo',
'TABLE', N'product_spec'
GO


-- ----------------------------
-- Primary Key structure for table product_spec
-- ----------------------------
ALTER TABLE [dbo].[product_spec] ADD CONSTRAINT [PK_product_spec] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO